{extend name="Index/index" /}
{block name="mobile"}
<style>
    .nav-show {
        margin-top: 20px;
        font-size: 40px;

    }

    .nav-show h1 {
        font-size: 50px;

    }

    .nav-show p {
        color: darkgrey;
    }

    .nav-show p span {
        color: goldenrod;
    }

    .nav-push {
        margin-top: 30px;
        font-size: 50px;
    }

    .nav-push ul {
        list-style: none;
    }

    .nav-push li {
        text-align: center;
    }

    .nav-push button{
    height: 70px;
    font-size:40px;
    }


    .nav-des {
        margin-top: 30px;
        font-size: 40px;
    }
    .nav-des h2 {
        font-size: 40px;
        color: darkgrey;
    }
    .nav-com {
        font-size: 40px;
        margin-top: 30px;
        color: darkgrey;
    }
    .nav-com h2 {
        font-size: 50px;
    }
    .nav-com h3{
        font-size: 40px;

    }

</style>
<div class="nav-show col-xs-12">
    <div class="nav-name col-xs-7">
        <h1>{$data.mname}</h1>
        <p><span>{$data.score}</span>分&nbsp;<span>{$people}</span>人评价</p>
        <span>{$data.mtime}分钟 / {$data.type} / {$data.director}(导演) /
             {foreach $res as $v}
            {$v.name} /
            {/foreach}
            {$data.myear}上映
        </span>
    </div>

    <div class="col-xs-5" style="margin-top:60px;">
        <img src="../../../../../uploads/{$data.cover}" rel="v:image" width="350"/>
    </div>
</div>

<div class="nav-push col-xs-12">
    <ul class="">
        <li class="col-xs-6">
            {if empty($Think.session.id)}
            <a class="j " href="{:url('mobile/Login/index')}" rel="nofollow" style="text-decoration: none;">写短评</a>
            {else/}
            {if empty($com)}
            <a class="j " href="{:url('mobile/Comment/insert',['id'=>$data['id']])}" rel="nofollow" style="text-decoration: none;">写短评</a>
            {else/}
            <b>已评论</b>
            {/if}
            {/if}

        </li>
        <li  class="col-xs-6">
            {if empty($Think.session.id)}
            <a  class="j" href="{:url('index/Login/index')}" >收藏</a>
            {else/}
            {if $data.id==$fav.id}
            <button class="btn btn-warning btn" id="del-btn" data-id="{$data['id']}" status="1">取消收藏</button>
            {else/}
            <button class="btn btn-warning btn" id="del-btn" data-id="{$data['id']}" status="0">收藏</button>
            {/if}
            {/if}
        </li>

        {js href="/static/admin/js/jquery.min.js"}
        {js href="/static/admin/js/bootstrap.min.js"}
        <script>
            $(function(){

                // 触发取消收藏/收藏
                $('#del-btn').click(function (){
                    var mv_id = $(this).attr('data-id');
                    var id = $(this).attr('id');
                    var obj = $(this);
                    if(obj.attr('status')==1){
                        console.log(obj.attr('status'));
                        delAjax(mv_id, obj);
                    }else{
                        console.log(obj.attr('status'));
                        getAjax(mv_id, obj);
                    }
                });



                // AJAX取消
                function delAjax(id,obj){
                    $.ajax({
                        type: 'post',
                        url: '/mobile/Index/delfav',
                        data: {
                            id:id
                        },
                        dataType: 'json',
                        success: function (data) {
                            if (data.status) {
                                obj.text('收藏');
                                obj.attr('status','0');
                            } else {
                            }
                        },
                        error: function () {
                            alert('AJAX操作失败');
                        }
                    });
//                    return false;
                }

                // AJAX收藏
                function getAjax(id,obj){
                    $.ajax({
                        type: 'post',
                        url: '/mobile/Index/favorite',
                        data: {
                            id:id
                        },
                        dataType: 'json',
                        success: function (data) {
                            if (data.status) {
                                obj.text('取消收藏');
                                obj.attr('status','1');
                            } else {
                            }
                        },
                        error: function () {
                            alert('AJAX操作失败');
                        }
                    });
//                    return false;
                }
            })
        </script>

    </ul>
</div>
<div class="nav-des col-xs-12">
    <a name="intro"></a>
    <h2>
        <i class="">剧情简介</i>
        · · · · · ·
    </h2>

    <div class="i">

                        <span property="v:summary" class="">
                                　　{$data.describe}
                        </span>

    </div>
</div>
<div class="nav-com col-xs-12">
    <h2>
        {$data.mname}的影评(
        {if $people!=0 }
        <span class="pl">全部 {$people} 条</span>
        {else /} <span class="pl">暂无评论</span>
        {/if})
    </h2>
</div>
{volist name='rev' id='c'}

<div class="nav-com col-xs-12">
        <a href = "javascript:return false" class="avator" >
            {if empty($c.face)}
            <img width="84" height="84" src="/static/index/face/face.png">
            {else/}
            <img width="84" height="84" src="/uploads/{$c.face}">
            {/if}
        </a>
        <span style="color:black;">{$c.name}&nbsp;</span>
        <span property="v:dtreviewed" content="2018-03-24" class="main-meta">{$c.time}</span>


    <div class="main-bd">

        <h3>{$c.title}</h3>
            <p class="col-xs-11 text-justify" style="color:black;word-break:break-all;word-wrap:break-word">
                {$c.comment}
            </p>
    </div>
</div>
{/volist}
{/block}